﻿@{ Layout = "../Shared/_Layout.cshtml"; } @section Navs{ <li class="nav-item">
  <a class="nav-link active" href="add.cshtml">添加插件</a>
</li>
<li class="nav-item">
  <a class="nav-link" href="manage.cshtml">管理插件</a>
</li> } <div class="row mt-4">
  <div class="col-10">
    <div class="form-inline">
      <div class="form-group">
        <label class="col-form-label m-r-10">关键字</label>
        <input v-model="keyword" type="text" placeholder="请输入关键字..." class="form-control" style="width: 400px">
      </div>
      <button v-on:click="btnSearchClick()" class="btn btn-success m-l-10 btn-md">搜索插件</button>
    </div>
  </div>
  <div class="col-2">
    <!-- <button v-on:click="btnUploadClick()" class="btn btn-default m-l-10 btn-md float-right">离线安装</button> -->
  </div>
</div>
<template v-if="q">
  <div class="page-title-box">
    <h4 v-if="packages && packages.length > 0" class="page-title">搜索到 {{packages.length}} 个结果</h4>
    <h4 v-else class="page-title">未找到搜索结果，建议更换搜索词</h4>
  </div>
</template>
<template v-else>
  <div class="page-title-box">
    <h4 class="page-title">精选</h4>
  </div>
</template>
<div class="card-box row" v-for="package in packages" v-if="!package.pluginInfo.price || package.pluginInfo.price == 0">
  <div class="col-sm-1 hidden-xs hidden-sm">
    <img :src="getIconUrl(package.pluginInfo.iconUrl)" class="img-responsive" style="max-width: 100%;">
  </div>
  <div class="col-sm-11">
    <div>
      <a :href="'view.cshtml?pluginId=' + package.pluginInfo.pluginId + '&returnUrl=' + encodeURIComponent(location.href)"
        class="text-primary font-16"> {{ package.pluginInfo.pluginId }} - {{ package.pluginInfo.title }}</a>
      <span v-if="packageIds.indexOf(package.pluginInfo.pluginId) !== -1" class="text-danger">（已安装）</span>
      <span class="ml-3"> 开发者： <a :href="'https://www.siteserver.cn/users/user.html?userName=' + package.userInfo.userName"
          target="_blank" class="text-primary"> {{ package.userInfo.displayName }} </a>
      </span>
    </div>
    <div class="mt-2 mb-2">
      <span class="text-dark"> 价格： <span v-if="package.pluginInfo.price" class="text-primary">{{package.pluginInfo.price.toFixed(2)}}</span>
        <span v-else="package.pluginInfo.price" class="text-primary">免 费</span>
      </span>
      <span>
        <span class="ml-2 mr-2 text-dark">|</span>
        <span class="text-dark"> 最新版本: <span class="text-primary"> {{ package.releaseInfo.version }} </span>
        </span>
        <span class="ml-2 mr-2 text-dark">|</span>
        <span class="text-dark"> 更新时间： <span class="text-primary"> {{ package.releaseInfo.published }} </span>
        </span>
        <span v-if="package.pluginInfo.tags">
          <span class="ml-2 mr-2 text-dark">|</span>
          <span class="text-dark"> 标签： <a v-for="tagName in getTagNames(package.pluginInfo)" class="mr-2 text-primary"
              :href="'?q=' + encodeURIComponent(tagName)">{{ tagName }}</a>
          </span>
        </span>
      </span>
    </div>
    <div style="max-height: 65px; overflow: hidden;"> {{ package.pluginInfo.summary }} </div>
  </div>
</div>
<a v-if="!q" href="https://www.siteserver.cn/plugins/" target="_blank" class="btn btn-primary btn-block">更多</a>
@section Scripts{ <script src="add.js" type="text/javascript"></script> }